<?php
/**
* Featured Youtube Slider - Joomla Module
* Version			: 2.0
* Created by		: RBO - http://www.rumahbelanja.com
* Created on		: October 2009 (For Joomla 1.5.x) and December 2010 (For Joomla 1.6.x)
* Updated			: December 24rd, 2010
* Package			: Joomla 1.5.x
* License			: http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*/
defined('_JEXEC') or die('Restricted access');
$document 		=& JFactory::getDocument();
$baseurl 		= JURI::base();

$youtubecode 		= $params->get( 'youtubecode' );
$width		 		= $params->get( 'width', 250 );
$height		 		= $params->get( 'height', 220 );
$fullsc_btn			= $params->get( 'fullsc_btn' );
$player_border		= $params->get( 'player_border' );
$player_clr1		= $params->get( 'player_clr1' );
$player_clr2		= $params->get( 'player_clr2' );

$height_thumbs		= $params->get( 'height_thumbs', 60 );
$outer_color 		= $params->get( 'outer_color', '#000' );
$inner_color 		= $params->get( 'inner_color', '#fff' );
$pagination_color 	= $params->get( 'pagination_color', '#0f0f0f' );
$inner_padding 		= $params->get( 'inner_padding', 5 );
$num_vid			= $params->get( 'num_vid');
$thumb_align		= $params->get( 'thumb_align');

$youtubelist 	= explode( ',', $youtubecode );
$numyoutube 	= count($youtubelist);

$width_thumb	= ($width/$num_vid) - ($inner_padding);

//Get this module id
$featytslide	= $module->id;

//Get duplicate module or not
$a=1;
foreach ($list as $item) :
	//$total=$a;
	$enddbid = $item->id;
		if ($featytslide==$enddbid) {$nummod=$a;}
	$a++;	
endforeach;

$document->addCustomTag("<script src='".$baseurl."modules/mod_featured_youtube_slider/library/contentslider.js'></script>");
$document->addStyleSheet('modules/mod_featured_youtube_slider/css/style.css');
?>
<style type="text/css">
	.modfytslider{
		background: <?php echo $inner_color;?>;
		width: <?php echo $width+16;?>px;
	}
	.sliderwrapper{
		width: <?php echo $width+10;?>px;
		height: <?php echo $height+2*$inner_padding;?>px;
		background: <?php echo $outer_color;?>;
	}
	.sliderwrapper .contentdiv{
		padding: <?php echo $inner_padding;?>px;
		background: <?php echo $inner_color;?>;
		width: <?php echo $width;?>px; /*width of content DIVs within slider. Total width should equal slider's inner width (390+5+5=400) */
		height: <?php echo $height+$inner_padding;?>px;
	}

	.paginationfytslide{
		width: <?php echo $width+16;?>px; /*Width of pagination DIV. Total width should equal slider's outer width */
		background: <?php echo $pagination_color;?>;
	}
</style>
<div class="modfytslider">
<div id="fytslider<?php echo $nummod; ?>" class="sliderwrapper">
	<?php for ($i=0; $i<$numyoutube; $i++) { ?>
	<div class="contentdiv">
		<object width="<?php echo $width;?>" height="<?php echo $height;?>">
		<param name="movie" value="http://www.youtube.com/v/<?php echo $youtubelist[$i];?>?rel=0&color1=0x<?php echo $player_clr1; ?>&color2=0x<?php echo $player_clr2; ?>&border=<?php echo $player_border; ?>&fs=<?php echo $fullsc_btn; ?>"></param>
		<param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param>
		<embed src="http://www.youtube.com/v/<?php echo $youtubelist[$i];?>?rel=0&color1=0x<?php echo $player_clr1; ?>&color2=0x<?php echo $player_clr2; ?>&border=<?php echo $player_border; ?>&fs=<?php echo $fullsc_btn; ?>" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="<?php echo $width;?>" height="<?php echo $height;?>"></embed>
		</object>
	</div>
	<?php } ?>
</div>

<div id="paginate-fytslider<?php echo $nummod; ?>" class="paginationfytslide">
	<div style="text-align: <?php echo $thumb_align; ?>; padding-left: 2px; padding-right: 2px;">
	<?php for ($i=0; $i<$numyoutube; $i++) { ?>
		<a href="#" class="toc">
			<img src="http://i3.ytimg.com/vi/<?php echo $youtubelist[$i];?>/default.jpg" width="<?php echo $width_thumb; ?>px" height="<?php echo $height_thumbs; ?>px"></img>
		</a>
	<?php } ?>
	</div>
	<div style="text-align: right; font-size:8px; padding-right:3px; font-family:fantasy;"><a href="http://www.showlands.com" target="_blank" title="Powered by Featured YouTube Slider">YouTube Slider</a></div>
</div>
</div>
<script type="text/javascript">

featuredcontentslider.init({
	id: "fytslider<?php echo $nummod; ?>",  //id of main slider DIV
	contentsource: ["inline", ""],  
	toc: "markup",  //Valid values: "#increment", "markup", ["label1", "label2", etc]
	nextprev: ["Previous", "Next"],  //labels for "prev" and "next" links. Set to "" to hide.
	revealtype: "click", //Behavior of pagination links to reveal the slides: "click" or "mouseover"
	enablefade: [true, 0.2],  //[true/false, fadedegree]
	autorotate: [false, 3000],  //[true/false, pausetime]
	onChange: function(previndex, curindex){  //event handler fired whenever script changes slide
		//previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
		//curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)
	}
})

</script>